cssanimatedstyle: Avoid some type checks and unnecessary work
authorTimm Bäder <mail@baedert.org>
Sat, 19 Jan 2019 17:05:13 +0000 (18:05 +0100)
committerTimm Bäder <mail@baedert.org>
Tue, 29 Jan 2019 04:03:26 +0000 (05:03 +0100)
gtk/gtkcssanimatedstyle.c
gtk/gtkcsscolorvalue.c
gtk/gtkcssstaticstyle.c

index 0dcd16c0293d62b5313cf0bc1f7d8bd01146f3a8..54dfa3684a4ce07f1fb68e7f8868742a270b215d 100644 (file)
@@ -186,14 +186,13 @@ transition_info_add (TransitionInfo    infos[GTK_CSS_PROPERTY_N_PROPERTIES],
                      GtkStyleProperty *property,
                      guint             index)
 {
-  gtk_internal_return_if_fail (GTK_IS_STYLE_PROPERTY (property));
-
   if (GTK_IS_CSS_SHORTHAND_PROPERTY (property))
     {
-      GtkCssShorthandProperty *shorthand = GTK_CSS_SHORTHAND_PROPERTY (property);
+      GtkCssShorthandProperty *shorthand = (GtkCssShorthandProperty *) property;
+      guint len = _gtk_css_shorthand_property_get_n_subproperties (shorthand);
       guint i;
 
-      for (i = 0; i < _gtk_css_shorthand_property_get_n_subproperties (shorthand); i++)
+      for (i = 0; i < len; i++)
         {
           GtkCssStyleProperty *prop = _gtk_css_shorthand_property_get_subproperty (shorthand, i);
 
@@ -228,9 +227,10 @@ transition_infos_set (TransitionInfo  infos[GTK_CSS_PROPERTY_N_PROPERTIES],
       prop_value = _gtk_css_array_value_get_nth (transitions, i);
       if (g_ascii_strcasecmp (_gtk_css_ident_value_get (prop_value), "all") == 0)
         {
+          const guint len = _gtk_css_style_property_get_n_properties ();
           guint j;
 
-          for (j = 0; j < _gtk_css_style_property_get_n_properties (); j++)
+          for (j = 0; j < len; j++)
             {
               property = GTK_STYLE_PROPERTY (_gtk_css_style_property_lookup_by_id (j));
               transition_info_add (infos, property, i);
index a98f142d54bfe5ebab383c0768886faa8c074c37..7f39810e134a0bb9cb7414d3ecd8875e625086c4 100644 (file)
@@ -151,7 +151,6 @@ _gtk_css_color_value_resolve (GtkCssValue      *color,
   GtkCssValue *value;
 
   gtk_internal_return_val_if_fail (color != NULL, NULL);
-  gtk_internal_return_val_if_fail (provider == NULL || GTK_IS_STYLE_PROVIDER (provider), NULL);
 
   switch (color->type)
     {
index a87b4097614dd276610aa5232fd58a7ef567455d..e257296fd0bf8011a418d35b2aaee96dfd1b0b63 100644 (file)
@@ -207,9 +207,6 @@ gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
 {
   GtkCssValue *value;
 
-  gtk_internal_return_if_fail (GTK_IS_CSS_STATIC_STYLE (style));
-  gtk_internal_return_if_fail (GTK_IS_STYLE_PROVIDER (provider));
-  gtk_internal_return_if_fail (parent_style == NULL || GTK_IS_CSS_STYLE (parent_style));
   gtk_internal_return_if_fail (id < GTK_CSS_PROPERTY_N_PROPERTIES);
 
   /* http://www.w3.org/TR/css3-cascade/#cascade